package com.hmall.domain.constant;

/**
 * es常量接口
 *
 * @Author XiaoJiangShi
 * @Date 2022/8/10 10:54
 * @Blog blog.XiaoJiangShi.net/996.mba
 * @Description:
 */
public interface EsConstant {
    /**
     * es服务器主机
     */
    String ES_HOST = "192.168.115.128";

    /**
     * es端口
     */
    int ES_PORT = 9200;

    /**
     * item商品类的索引名称
     */
    String ITEM_INDEX = "item";

    /**
     * item商品类创建索引的mapping和setting结构
     */
    String ITEM_INDEX_MAPPING = "{\n" +
            "   \"settings\": {\n" +
            "       \"analysis\": {\n" +
            "           \"analyzer\": { \n" +
            "               \"text_analyzer\": { \n" +
            "                   \"tokenizer\": \"ik_max_word\",\n" +
            "                   \"filter\": \"py\" \n" +
            "               },\n" +
            "               \"completion_analyzer\": { \n" +
            "                   \"tokenizer\": \"keyword\", \n" +
            "                   \"filter\": \"py\" \n" +
            "               }\n" +
            "           },\n" +
            "           \"filter\": {\n" +
            "               \"py\": {\n" +
            "                   \"type\": \"pinyin\",\n" +
            "                   \"keep_full_pinyin\":false,\n" +
            "                   \"keep_joined_full_pinyin\":true,\n" +
            "                   \"keep_original\":true,\n" +
            "                   \"limit_first_letter_length\":16,\n" +
            "                   \"remove_duplicated_term\":true,\n" +
            "                   \"none_chinese_pinyin_tokenize\":false\n" +
            "               }\n" +
            "           }\n" +
            "       }\n" +
            "   },\n" +
            "   \"mappings\": {\n" +
            "       \"properties\": {\n" +
            "           \"id\": {\n" +
            "               \"type\": \"keyword\"\n" +
            "           },\n" +
            "           \"name\":{\n" +
            "               \"type\": \"text\",\n" +
            "               \"analyzer\": \"text_analyzer\",\n" +
            "               \"search_analyzer\": \"ik_smart\",\n" +
            "               \"copy_to\": \"all\"\n" +
            "           },\n" +
            "           \"category\":{\n" +
            "               \"type\": \"keyword\",\n" +
            "               \"analyzer\": \"ik_max_word\",\n" +
            "               \"copy_to\": \"all\"\n" +
            "           },\n" +
            "           \"price\":{\n" +
            "               \"type\": \"long\"\n" +
            "           },\n" +
            "           \"sold\":{\n" +
            "               \"type\": \"integer\"\n" +
            "           },\n" +
            "           \"brand\":{\n" +
            "               \"type\": \"keyword\",\n" +
            "               \"copy_to\": \"all\"\n" +
            "           },\n" +
            "           \"commentCount\":{\n" +
            "               \"type\": \"integer\"\n" +
            "               \"index\": false\n" +
            "           },\n" +
            "           \"image\":{\n" +
            "               \"type\": \"keyword\",\n" +
            "               \"index\": false\n" +
            "           },\n" +
            "           \"all\":{\n" +
            "               \"type\": \"text\",\n" +
            "               \"analyzer\": \"text_analyzer\",\n" +
            "               \"search_analyzer\": \"ik_smart\"\n" +
            "           },\n" +
            "           \"isAD\":{\n" +
            "               \"type\": \"boolean\"\n" +
            "           },\n" +
            "           \"suggestion\":{\n" +
            "               \"type\": \"completion\",\n" +
            "               \"analyzer\": \"completion_analyzer\"\n" +
            "           }\n" +
            "       }\n" +
            "   }\n" +
            "}\n";
}
